#include<iostream>
#include<unistd.h>
#include<sys/types.h>
#include<signal.h>

void test_print(int signal_num){// 形参表示收到了那个信号signal_num
    std::cout<<"accept signal: "<<signal_num<<std::endl;
}

int main(){
    signal(SIGINT,test_print);

    while(true){
        std::cout<<"my precess: "<<getpid()<<std::endl; 
        sleep(1);
    }

    return 0;
}